package lgy.kunpeng.homework;

import java.util.Scanner;

public class op07 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int sum=0;
        for(int i=0;i<5;i++){
            System.out.println("欢迎光临第"+i+"家店");
            while (true){
                System.out.println("要离开吗（y/n）");
                String choice = input.nextLine();
                int num=0;
                if(choice.equals("y")||num<=3)
                {
                    System.out.println("买了一件衣服");
                    sum++;
                    continue;
                }
                else if(choice.equals("y")||num>3)
                {
                    System.out.println("超出购买上限");
                    break;
                }
                else
                {
                    System.out.println("结账离开");
                    break;
                }
            }
            System.out.println("一共购买了"+sum+"件衣服");
        }
    }
}
